﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace VVA.Website.UI
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute("Recruitment-en", "Recruitment/{page}", new { controller = "News", action = "Recruitment", page = UrlParameter.Optional, culture = "en-US" });
            routes.MapRoute("Recruitment", "tuyen-dung/{page}", new { controller = "News", action = "Recruitment", page = UrlParameter.Optional, culture = "vi-VN" });

            routes.MapRoute("About-en", "About/{slug}", new { controller = "About", action = "Detail", culture = "en-US" }, new string[] { "VVA.Website.UI.Controllers" });
            routes.MapRoute("About", "ve-chung-toi/{slug}", new { controller = "About", action = "Detail", culture = "vi-VN" }, new string[] { "VVA.Website.UI.Controllers" });

            routes.MapRoute("ReadProduct-en", "Product/Read/{slug}", new { controller = "Product", action = "Read", culture = "en-US" }, new string[] { "VVA.Website.UI.Controllers" });
            routes.MapRoute("ReadProduct", "san-pham/chi-tiet-san-pham/{slug}", new { controller = "Product", action = "Read", culture = "vi-VN" }, new string[] { "VVA.Website.UI.Controllers" });

            routes.MapRoute("Product-en", "Product/{slug}", new { controller = "Product", action = "Detail", culture = "en-US" }, new string[] { "VVA.Website.UI.Controllers" });
            routes.MapRoute("Product", "san-pham/{slug}", new { controller = "Product", action = "Detail", culture = "vi-VN" }, new string[] { "VVA.Website.UI.Controllers" });

            routes.MapRoute("ReadNews-en", "News/Read/{slug}", new { controller = "News", action = "Read", culture = "en-US" });
            routes.MapRoute("ReadNews", "tin-tuc/tin-chi-tiet/{slug}", new { controller = "News", action = "Read", culture = "vi-VN" });           

            routes.MapRoute("News-en", "News/{slug}", new { controller = "News", action = "Index", culture = "en-US" }, new string[] { "VVA.Website.UI.Controllers" });
            routes.MapRoute("News", "tin-tuc/{slug}", new { controller = "News", action = "Index", culture = "vi-VN" }, new string[] { "VVA.Website.UI.Controllers" });

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{culture}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional, culture = "vi-VN" },
                constraints: new { culture = @"vi-VN|en-US" },
                namespaces: new string[] { "VVA.Website.UI.Controllers" }
            );
        }
    }
}